package com.fancon.android.gardenjokesx.social;

import android.content.Context;
import android.util.Log;

//Encapsulation main Weibo APIs, Include: 1. getRquestToken , 2. getAccessToken, 3. url request.
//Implements a weibo api as a asynchronized way. Every object used this runner should implement interface RequestListener.

public class AsyncWeiboRunner {
	
	private Weibo mWeibo;
	
	public AsyncWeiboRunner(Weibo weibo){
		this.mWeibo = weibo;
	}
	
	public Boolean request(
			final Context context, 
			final String url, 
			final WeiboParameters params, 
			final String httpMethod){
                try {
					String resp = mWeibo.request(context, url, params, httpMethod, mWeibo.getAccessToken());
					Log.v("resp", resp);
                    return true;
                } catch (WeiboException e) {
                	return false;
                }
	}

}
